#ifndef _CONSTANTBUFFERS_H
#define _CONSTANTBUFFERS_H

#include "types.hlsli"
#include "../../EdgeGraphics/Lighting/PointLight.h"
#include "../../EdgeGraphics/Lighting/DirectionalLight.h"

#define MAX_LIGHTS 4

#if __cplusplus
#include "../../EdgeMath/Geometry.h"
#define MAKE_BUFFER(name, reg) __declspec(align(16)) struct name {
#define RECT_F Box2D
#else
#define MAKE_BUFFER(name, reg) cbuffer name : register(reg) { 

struct RECT_F
{
	float left;
	float right;
	float top;
	float bottom;
};

#define RECT RECT_F
#endif
#define END_BUFFER };

MAKE_BUFFER(VRAM_WORLD, b0)
	float4x4 world;
	float4x4 gMVP;
	END_BUFFER

MAKE_BUFFER(VRAM_VIEWPROJ, b1)
	float4x4 view;
	float4x4 viewProj;
	float4x4 gInvViewProj;
END_BUFFER

MAKE_BUFFER(VRAM_TERRAIN, b2)
	float gTerrainHighest;
	float gTerrainLowest;
	float gTerrainWidth;
	float gTerrainHeight;
END_BUFFER

MAKE_BUFFER(VRAM_LIGHTING, b4)		
	float4x4 gView;					// 64
	float4 gCameraPosition;			// 16
	float4 gAmbiantColor;			// 16
	float3 gCameraDirection;		// 12
	float gFarDistance;				// 4
	float gNearDistance;			// 4
END_BUFFER

MAKE_BUFFER(VRAM_POINTLIGHT, b3)
	struct POINTLIGHT
	{
		float3 specularColor;		  // 12
		float range;				  // 16
		float3 ambientColor;		  // 28
		float3 diffuseColor;		  // 40
		float3 position;			  // 52
		float faevewr;				// padding
	} gPointLight;
END_BUFFER

MAKE_BUFFER(VRAM_DIRECTIONALLIGHT, b3)
	struct DIRLIGHT
	{
		float4 ambientColor;		  // 24
		float4 diffuseColor;		  // 36
		float4 direction;			  // 48
		float4 specularColor;		  // 60
	} gDirectionalLight;
END_BUFFER

MAKE_BUFFER(VRAM_VS_UI, b0)
	RECT_F region;
	RECT_F texRect;
END_BUFFER

MAKE_BUFFER(VRAM_PS_UI, b0)
	float4 color;
	int use_texture;
	int lkajdflkajsdlfkj [3]; // padding
END_BUFFER



#endif // #define _CONSTANTBUFFERS_H
